package com.yungu.swift.admin.config;

import com.yungu.swift.admin.base.LicenseCheck;
import com.yungu.swift.base.SpringContextHolder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.web.client.RestTemplate;

import java.nio.charset.StandardCharsets;

/**
 * @author xiuyin.cui
 * @Description
 * @date 2019/3/20 18:30
 */
@Configuration
public class SpringConfig {

    @Bean
    public SpringContextHolder springContextHolder() {
        return new SpringContextHolder();
    }

    @Bean
    public RestTemplate restTemplate() {
        RestTemplate restTemplate = new RestTemplate();
        restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8));
        return restTemplate;
    }


    @Bean(initMethod = "init")
    public LicenseCheck licenseCheck() {
        return new LicenseCheck();
    }

}
